package com.yvan.leto.server.security;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

public class PasswordHelper {
    public static final String ALGORITHM_NAME = "md5";
    public static final int HASH_ITERATIONS = 2;

    public static String encryptPassword(String pwd, String salt) {
        return new SimpleHash(ALGORITHM_NAME, pwd, ByteSource.Util.bytes(salt), HASH_ITERATIONS).toHex();
    }

    public static void main(String[] args) {
        String pwd = PasswordHelper.encryptPassword("admin", "jzt600998");
        System.out.println(pwd);
    }
}
